<?php
if($_SESSION[SESSION_ADMIN] != ADMIN_USER)
{
	header('Location: login.php');
	die();
}
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" 
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html>
<head>
	<title><?php print LANG_010; ?></title>
	<meta content="text/html; charset=utf-8" http-equiv="content-type" />
    <link href="<?php print PUNG_URL . '/admin/admin_'; ?>style.css" rel="stylesheet" type="text/css" />
    <script type="text/javascript" src="<?php print PUNG_URL;?>/scripts/jquery-1.4.2.js"></script>
	<script type="text/javascript" src="<?php print PUNG_URL . '/scripts/ajax.js'; ?>"></script>
	<script type="text/javascript" src="<?php print PUNG_URL . '/scripts/functions.js'; ?>"></script>
</head>

<body>
<div class='topbar'>
  <table cellpadding='0' cellspacing='0' width='100%'>
  <tr>
  <td width="16%" valign='top'><img src='<?php print PUNG_URL;?>/admin/images/admin_icon.gif' border='0'></td>
  <td width="84%" align='right' valign='top'>
  <img src='<?php print PUNG_URL;?>/admin/images/admin_watermark.gif' border='0'>
  <div id="iconsbar">
    	<ul>
        	<li>
	
		<a href="<?php print PUNG_URL . '/admin/index.php'; ?>" title="<?php print LANG_001; ?>"><img 
		src="<?php print PUNG_URL . '/images/admin_img/'; ?>home.png" alt="<?php print LANG_001; ?>" /></a>
		
			</li>
			<li>
		<a href="<?php print PUNG_URL . '/admin/themes.php'; ?>" title="<?php print LANG_002; ?>"><img 
		src="<?php print PUNG_URL . '/images/admin_img/'; ?>themes.png" alt="<?php print LANG_002; ?>" /></a>
		
			</li>
            <li>
		
		<a href="<?php print PUNG_URL . '/admin/blocks.php'; ?>" title="<?php print LANG_009; ?>"><img 
		src="<?php print PUNG_URL . '/images/admin_img/'; ?>blocks.png" alt="<?php print LANG_009; ?>" /></a>
		
			</li>
            <li>
		
		<a href="<?php print PUNG_URL . '/admin/images.php'; ?>" title="<?php print LANG_003; ?>"><img 
		src="<?php print PUNG_URL . '/images/admin_img/'; ?>images.png" alt="<?php print LANG_003; ?>" /></a>
		
			</li>
            <li>
		
		<a href="<?php print PUNG_URL . '/admin/modules.php'; ?>" title="<?php print LANG_004; ?>"><img 
		src="<?php print PUNG_URL . '/images/admin_img/'; ?>modules.png" alt="<?php print LANG_004; ?>" /></a>
		
			</li>
            <li>
		
		<a href="<?php print PUNG_URL . '/admin/settings.php'; ?>" title="<?php print LANG_005; ?>"><img 
		src="<?php print PUNG_URL . '/images/admin_img/'; ?>settings.png" alt="<?php print LANG_005; ?>" /></a>
		
			</li>
            <li>
		
		<a href="<?php print PUNG_URL . '/admin/system.php'; ?>" title="<?php print LANG_006; ?>"><img 
		src="<?php print PUNG_URL . '/images/admin_img/'; ?>system.png" alt="<?php print LANG_006; ?>" /></a>
		
			</li>
            <li>
		
		<?php if(PHPCONSOLE == 'on') { ?>
		<a href="<?php print PUNG_URL . '/admin/console.php'; ?>" title="<?php print LANG_007; ?>"><img 
		src="<?php print PUNG_URL . '/images/admin_img/'; ?>console.png" alt="<?php print LANG_007; ?>" /></a>
		
			</li>
            <li>
		<?php } ?>
		
		<a href="<?php print PUNG_URL . '/admin/login.php?do=logout'; ?>" title="<?php print LANG_008; ?>"><img 
		src="<?php print PUNG_URL . '/images/admin_img/'; ?>logout.png" alt="<?php print LANG_008; ?>" /></a>
			</li>
     </ul>       
</div>
</td>
  </tr>
  </table>
</div>

<div id="leftbar">

	<?php
	$sql = $db -> db_query("SELECT * FROM " . DB_PREFIX . "modules WHERE 
	hasadmin = 'yes' ORDER BY date DESC");
	$sql = $db -> db_result();
	?>
<div class="box" style="width: 225px; margin-top: 13px; margin-left: auto; margin-right: auto;">
  <div class="left"></div>
  <div class="right"></div>
  <div class="heading">
    <h1 style="background-image: url('<?php print PUNG_URL;?>/admin/images/lockscreen.png');"><div id="moduletitle"><?php print LANG_011; ?></div></h1>
  </div>
  <div class="content">
   
   <div id="modulesbar">
	<div>
		
		<ul>
			<?php foreach($sql as $module) { ?>
			<li><a href="<?php print PUNG_URL . '/modules/' . $module['folder'] . '/admin/index.php'; ?>"><?php 
			print $module['name']; ?></a></li>
			<?php } ?>
		</ul>
	</div>
	</div>
    
    
  </div>
</div>		
	
	<div class="clear"></div>

</div>

<div id="contentbar">

	<div id="tabs">
		
		<ul id="tabnav">
			<?php
			$current = basename($_SERVER['SCRIPT_FILENAME']);
			foreach($adminmenu as $key => $value)
			{
				if($current == $value)
				{
					print '<li><a href="' . $value . '" class="active">' . $key . '</a></li>';
				}
				else
				{
					print '<li><a href="' . $value . '">' . $key . '</a></li>';
				}
			}
			?>
		</ul>

	</div>
	
	<div id="content_tab">
	
	<?php
	if(isset($_GET['error']))
	{
		print '<div id="error">' . constant($_GET['error']) . '</div>';
	}
	elseif(isset($_GET['warning']))
	{
		print '<div id="warning">' . constant($_GET['warning']) . '</div>';
	}
	elseif(isset($_GET['msg']))
	{
		print '<div id="message">' . constant($_GET['msg']) . '</div>';
	}
	?>
	